#include <cstring>
#include <string>
#include "vl_props.h"

using namespace VL;

int main(int argc, const char** argv) {
	if(argc != 2) {
		return 1;
	}

	VLProp prop;
	try {
		VLProp::readVLP(argv[1], prop);
		if(prop["a"].intValue() != 1) {
			return 3;
		}
		if(prop["b"].strValue().compare("\"2\"") != 0) {
			return 4;
		}
		if(prop["c"].doubleValue() != 2) {
			return 5;
		}
		auto & dArr = prop["d"];
		if(!dArr.isArray()) {
			return 6;
		}
		if(dArr.size() != 3) {
			return 7;
		}
		if(dArr[0].intValue() != 1) {
			return 8;
		}
		if(dArr[1].strValue().compare("\"2\"") != 0) {
			return 9;
		}
		if(dArr[2].doubleValue() != 2) {
			return 10;
		}
		auto & eMap = prop["e"];
		if(!eMap.isMap()) {
			return 11;
		}
		if(eMap["a"].intValue() != 1) {
			return 12;
		}
		if(eMap["b"].strValue().compare("\"2\"") != 0) {
			return 13;
		}
		if(eMap["c"].doubleValue() != 2) {
			return 14;
		}
		auto & childDArr = eMap["d"];
		if(!childDArr.isArray()) {
			return 15;
		}
		if(childDArr.size() != 3) {
			return 16;
		}
		if(childDArr[0].intValue() != 1) {
			return 17;
		}
		if(childDArr[1].strValue().compare("\"2\"") != 0) {
			return 18;
		}
		if(childDArr[2].doubleValue() != 2) {
			return 19;
		}
		if(!prop["f"].isArray()) {
			return 20;
		}
		if(prop["f"].size() != 1) {
			return 21;
		}
		auto & childMap = prop["f"][0];
		if(!childMap.isMap()) {
			return 22;
		}
		if(childMap["a"].intValue() != 1) {
			return 23;
		}
		if(childMap["b"].strValue().compare("\"2\"") != 0) {
			return 24;
		}
		if(childMap["c"].doubleValue() != 2) {
			return 25;
		}
		auto & childChildDArr = childMap["d"];
		if(!childChildDArr.isArray()) {
			return 26;
		}
		if(childChildDArr.size() != 3) {
			return 27;
		}
		if(childChildDArr[0].intValue() != 1) {
			return 28;
		}
		if(childChildDArr[1].strValue().compare("\"2\"") != 0) {
			return 29;
		}
		if(childChildDArr[2].doubleValue() != 2) {
			return 30;
		}
		
	} catch(const VLPropExcetion& exception) {
		printf("error: %s\n", exception.message.c_str());
		return 2;
	} catch(...) {
		return 2;
	}

	return 0;
}